package org.aplombh.java.interview.newcoder;

import java.util.*;

public class HJ27_查找兄弟单词 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        String[] all = new String[n];
        for (int i = 0; i < n; i++) {
            all[i] = in.next();
        }
        String pat = in.next();
        int k = in.nextInt();


        Arrays.sort(all);
        char[] chars = pat.toCharArray();
        Arrays.sort(chars);

        String str = "";
        int num =  0;
        for (String s : all) {
            if (pat.length() == s.length() && !pat.equals(s)) {
                char[] tmp = s.toCharArray();
                Arrays.sort(tmp);
                if (Arrays.equals(chars, tmp)) {
                    num++;
                    if (num == k) {
                        str = s;
                    }
                }
            }
        }
        System.out.println(num);
        System.out.println(str);
    }
}
